package javacore.v1ch6;

import javax.swing.*;
import java.util.Arrays;
import java.util.Date;


public class LambadaTest {

    public static void main(String[] args) {
        String[] plants = new String[] {"mercury", "venus", "earth", "mars", "jupiter", "saturn", "uranus", "neptune"};
        System.out.println(Arrays.toString(plants));

        Arrays.sort(plants);
        System.out.println(Arrays.toString(plants));
        System.out.println("sort by length");
        Arrays.sort(plants, (first, second) -> first.length() -second.length() );
        System.out.println(Arrays.toString(plants));

        Timer timers = new Timer(1000, event -> System.out.println("the timer is " + new Date()));
        timers = new Timer(100, System.out::println);

        timers.start();

        JOptionPane.showMessageDialog(null, "quit program");
        System.exit(0);
    }

}
